package com.camps.sdk.encrypt;

import com.camps.sdk.common.ExceptionCode;
import com.camps.sdk.entity.ChangeM1Card;
import com.camps.sdk.exception.BaseException;

/**
 * @Author ldaoliang
 * @Date create in 10:11 2021/9/1
 * @Description
 */
public class SetM1Command implements BuildCommand {
    @Override
    public String splicingParameters(String imei, Object params) {
        if (!(params instanceof ChangeM1Card)) {
            throw new BaseException(ExceptionCode.PARAMETER_ERROR);
        }
        ChangeM1Card changeM1Card = (ChangeM1Card) params;
        String m1Card = changeM1Card.getM1Card();
        String commandNumber = changeM1Card.getCommandNumber();
        StringBuilder sb = new StringBuilder("*WT,");
        sb = sb.append(imei).append(",SETM1,").append(commandNumber).append(",").append(m1Card).append("#");
        return sb.toString();
    }
}
